package com.abc.robot01.activity.compose

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.abc.robot01.activity.px

class ButtonDemo : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val scrollState = rememberScrollState()
            Column(
                modifier = Modifier
                    .padding(start = 10.dp, top = 10.dp)
                    .verticalScroll(scrollState)
                    .fillMaxSize(),
            ) {
                MyButton01()
                OutlinedButtonExample{}
            }
        }
    }
}

@Composable
fun OutlinedButtonExample(onClick: () -> Unit) {
    OutlinedButton(onClick = { onClick() },
        modifier = Modifier
            .padding(16.dp)
            .size(200.dp, 50.dp),
//        border = ButtonDefaults.outlinedButtonBorder.copy(
//            width = 2.dp, color = Color.Gray // 自定义边框厚度和颜色
//        )
        ) {
        Text("Outlined")
    }
}

@Composable
fun MyButton01() {
    Button(onClick = {  }) {
        repeat(10){
            Text(text = "$it")
            Spacer(modifier = Modifier.width(20.px))
        }
    }
}













